/*****调用关于用户操作相关的接口*******/
import  request from '@/http/request'

/****用户登录的操作*****/
export const  login=(data)=>{ //1
    return request({
        url:"/user/login", //http://localhost:8080/user/login 
        method:"post", //get post put delete
        headers:{
            "token":'a1234'
        },
        data
    })
}
/******根据id查询信息******/
export const getUserInfo=(id)=>{//localhost:8080/user/1
    return request ({
        url:`/user/${id}`,
        method:"get"
    })
}

/******修改用户信息******/
export const updateUserInfo=(data)=>{ 
    const formData = new FormData();
    for(const  key in data){
        if(data.hasOwnProperty(key)){
            const value  = data[key]
            formData.append(key,value)
        }
    } 
    return request({
        url:"/user/", //http://localhost:8080/user
        method:"put", //get post put delete
        data:formData
    })
}
